package com.bona.service.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bona.dao.common.BaseDao;
import com.bona.dao.system.SysIconDao;
import com.bona.model.system.SysIconModel;
import com.bona.service.common.BaseService;
import com.bona.util.common.StringUtil;
import com.bona.util.common.UUIDGenerator;

/**
 * 
 * <br>
 * <b>功能：</b>SysUserService<br>
 * <b>作者：</b>tbzeng<br>
 * <b>日期：</b> Dec 9, 2015 <br>
 * <b>版权所有：<b>版权所有(C) 2015，tbzeng<br>
 */
@Service("iconService")
@Transactional
public class SysIconService extends BaseService {

	@Autowired
	private SysIconDao iconDao;
	
	@Override
	public BaseDao getDao() {
		return iconDao;
	}

	/**
	 * 更新或者保存图标
	 * @param model
	 */
	public void addOrUpdate(SysIconModel model) {
		
		if (StringUtil.isEmpty(model.getId())) {
			model.setId(UUIDGenerator.generate());
			iconDao.add(model);
			return;
		}
		iconDao.update(model);
	}
}
